package com.msb;

import com.msb.service.DemoService;
import com.msb.service.impl.DemoServiceImpl;

import java.rmi.Naming;
import java.rmi.registry.LocateRegistry;

/**
 * @author sunpeng
 * @Date 2021-07-20 16:40
 */
public class DemoMain {
    public static void main(String[] args) throws Exception{
        //创建接口实例
        DemoService demoService = new DemoServiceImpl();
        //创建注册表
        LocateRegistry.createRegistry(8081);
        //注册服务
        Naming.bind("rmi://127.0.0.1:8081/demoService", demoService);
        System.out.println("服务器启动成功");
    }
}
